/* eslint-disable max-classes-per-file */
import { JsonProperty, Serializable } from '@/plugins/reflect-metadata';

import { TransactionQueryType } from '../const';
import TransactionItem from './TransactionItem';

@Serializable()
export class TransactionQuery {
  @JsonProperty('pageNum')
    pageNum: number = 1;

  @JsonProperty('pageSize')
    pageSize: number = 100;

  @JsonProperty('status')
    status: number = 0;

  get params() {
    if (this.status === TransactionQueryType.全部类型) {
      return {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
      };
    }
    return {
      transactionType: this.status,
      pageNum: this.pageNum,
      pageSize: this.pageSize,
    };
  }
}

@Serializable()
export class TransactionFlowTotal {
  @JsonProperty('totalRecordedAmount')
    totalRecordedAmount: number = 0;

  @JsonProperty('totalAmountToday')
    totalAmountToday: number = 0;

  @JsonProperty('totalWithdrawAmount')
    totalWithdrawAmount: number = 0;
}

@Serializable()
export default class TransactionList {
  @JsonProperty({ name: 'rows', type: TransactionItem })
    items: TransactionItem[] = [];

  @JsonProperty('total')
    total: number = 0;
}
